#include <stdio.h>
#include <string.h>
#include <unistd.h>

int main(int argc, char** argv)
{
    if(argc != 2)
    {
        printf("Usage: ./heart (-r | -g | -y | -b | -d)\n");
        return 1;
    }
    float x, y, z;
    for(x=1.5f; x>-1; x-=0.1f)
    {
        for(y=-1.5f; y<1.5f; y+=0.04f)
        {
            z = x*x + y*y - 1;
            if(z*z*z - x*x*x*y*y < 0.0f)
            {
                if(strcmp(argv[1], "-r") == 0)
                    printf("\033[5;31m*\033[0m");
                else if(strcmp(argv[1], "-g") == 0)
                    printf("\033[5;32m*\033[0m");
                else if(strcmp(argv[1], "-y") == 0)
                    printf("\033[5;33m*\033[0m");
                else if(strcmp(argv[1], "-b") == 0)
                    printf("\033[5;34m*\033[0m");
                else if(strcmp(argv[1], "-d") == 0)
                    printf("*");
                else 
                {
                    printf("comand error\n");
                    return 1;
                }
            }
            else 
                printf(" ");
        }
        usleep(150000);
        printf("\n");
    }
    return 0;
}
